<%@page import="DTO.AutorDTO"%>
<%@page contentType="text/html" pageEncoding="UTF-8" language="java" session="true"%>
<!DOCTYPE html>

<%
	AutorDTO autorDTO = (AutorDTO) session.getAttribute("autorDTO");		
%>

<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Cadastro: Autor</title>
		<link rel="stylesheet" type="text/css" href="../../livros/styles/styles.css" />
		<script type="text/javascript" src="../../livros/js/view.js"></script>
		<script type="text/javascript" src="../../livros/js/validacao.js"></script>
	</head>
	<body>
		<jsp:include page="../include/header.jsp"></jsp:include>

		<div id="conteudo">
			<div id="conteudoPagina">
				<h1>Cadastro de Autor</h1>
				<span class="warningsSpam"> 
					<h4 class="camposObrigatorios">* = Campos Obrigatórios</h4>			
					<%
				 	if (session.getAttribute("erro") != null) {
				 		out.println(session.getAttribute("erro"));
				 	} %> 
		 		</span>
				<form action="AutorServlet" method="post" onsubmit="return validarAutor(this)" enctype="multipart/form-data">
					<table>				
						<tr>
							<td>Nome:<span class="warningsSpam">*</span></td>
							<td><input type="text" name="nome" id="nome"
								value="<%=autorDTO.getNome() != null ? autorDTO.getNome() : ""%>">
							</td>
						</tr>
						<tr>
		                  	<td>Biografia:<span class="warningsSpam">*</span></td>
		                  	<td>
	                    		<textarea name="descricao" id="descricao" style="width: 500px; height: 80px"><%=autorDTO.getDescricao() != null ? autorDTO.getDescricao() : ""%></textarea>
		                  	</td>
		              	</tr>
		              	<tr>
							<td>Imagem</td>
							<td><input type="file" name="imagem" id="imagem" /></td>
						</tr>
					</table>
					<button type="submit" name="acao" id="acao" value="Incluir" class="botao">Incluir</button>
				</form>
				<form action="AutorServlet" method="post">
					<button type="submit" name="acao" id="acao" value="Cancelar" class="botao">Cancelar</button>
				</form>
			</div>
			<jsp:include page="../include/destaqueAutores.jsp"></jsp:include>
		</div>
	</body>
</html>